<template>
	<view class="box">
		<view class="box-mini-box">
			<view class="image-one">
				<view class="box-top">学时要求</view>
				<view class='box-introduce'>参与测评需修满{{parseInt(roleInfo.bi_score) + parseFloat(roleInfo.xuan_score) || "--"}}学时</view>
				<view class='image-one-box'>
					<view class="yuan1 yuan">
						<view class="yuan-num">
							{{roleInfo.bi_score||"--"}}
						</view>
						<view class='yuan-introduce'>
							必修
						</view>
					</view>
					<view class="yuan-num">+</view>
					<view class="yuan2 yuan">
						<view class="yuan-num">
							{{roleInfo.xuan_score||"--"}}
						</view>
						<view class='yuan-introduce'>
							选修
						</view>
					</view>
					<view class="yuan-num">=</view>
					<view class="yuan3 yuan">
						<view class="yuan-num">
							{{Number(roleInfo.bi_score) + Number(roleInfo.xuan_score) || "--"}}
						</view>
					</view>
				</view>
			</view>
			<view class="image-tow"> 
				<view class="box-top">测评规则</view>
				<view class="progress">
					<u-icon name="checkmark-circle-fill" color="#4A87FD" size="80" />
				</view>
				<view class="progress-introduce">总分{{roleInfo.total_score||'--'}}分，获得{{roleInfo.pass_score}}分及格</view>
				<view class="image-tow-line"></view>
				<u-image
					width="140rpx"
					height="140rpx"
					src="http://jjboss.oss-cn-hangzhou.aliyuncs.com/attachment/20220922/319ebc88db88befcec0de991f0d0e9f9.png"
				/>
				<view class="progress-introduce">测评时间{{roleInfo.total_time}}分钟</view>
				<view class="image-tow-line"></view>
				<u-image
					width="140rpx"
					height="140rpx"
					src="http://jjboss.oss-cn-hangzhou.aliyuncs.com/attachment/20220922/633573c4ea6b988b535da443c8479bab.png"
				/>
				<view class="progress-introduce">每人只有{{roleInfo.paper_all_count||'--'}}次测评机会</view>
			</view>
			<view class="image-three">
				<view class="box-top">题型分布</view>
				<view class="image-three-box">
					<view class="image-three-box-item">
						<u-image
							width="16rpx"
							height="16rpx"
							src="http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/fc4fb3be5eba850357947de8194a8921.png"
						/>
						<view class="image-three-box-item-detail">单选题{{roleInfo.radio_num||'--'}}道，每题{{roleInfo.radio_score||'--'}}分</view>
					</view>
					<view class="image-three-box-item">
						<u-image
							width="16rpx"
							height="16rpx"
							src="http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/fc4fb3be5eba850357947de8194a8921.png"
						/>
						<view class="image-three-box-item-detail">多选题{{roleInfo.checkbox_num||'--'}}道，每题{{roleInfo.checkbox_score||'--'}}分</view>
					</view>
					<view class="image-three-box-item">
						<u-image
							width="16rpx"
							height="16rpx"
							src="http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/fc4fb3be5eba850357947de8194a8921.png"
						/>
						<view class="image-three-box-item-detail">判断题{{roleInfo.judge_num||'--'}}道，每题{{roleInfo.checkbox_score||'--'}}分</view>
					</view>
				</view>
			</view>
			<view class="buttom"></view>
		</view>
		<view class="fix-buttom">
			<view 
				class="bg-box" 
				@click="lookRecord"
			>
				<view class="icon"></view>
				<view>测评记录</view>
			</view>
			<!-- :style="{'background-color':(this.totalGet>(Number(this.roleInfo.bi_score) + Number(this.roleInfo.xuan_score))) ? 'lightgrey':''}" -->
			<view class="times" @click="doTest">开始测评(剩余{{roleInfo.paper_count||'0'}}次机会)</view>
		</view>
	</view>
</template>

<script>
	import request from "@/pagesB/common/js/request/allRequest.js"
	export default {
		data() {
			return {
				roleInfo:{},
				scoreGet_bi:0,
				scoreGet_xuan:0
			}
		},
		onShow() {
			let data ={ }
			 if (uni.getStorageSync("eduInfo").sentryPid == 3){
				data = {type:4}
			}
			request.getNewTestRoles({
				data,
				success:(res)=>{
					this.roleInfo = res
				},
				fail:() => {
					uni.showToast({
						icon:"none",
						title:'获取数据失败'
					})
				}
			})
		},
		onLoad(option) {
			this.scoreGet_bi = option.scoreGet_bi;
			this.scoreGet_xuan = option.scoreGet_xuan
		},
		methods: {
			getRoles(){
				
			},
			lookRecord(){
				uni.navigateTo({
					url:'/pagesB/pages/newTestRecord/index'
				})
			},
			doTest(){
				if(this.scoreGet_bi < Number(this.roleInfo.bi_score) || this.scoreGet_xuan < Number(this.roleInfo.xuan_score)){
					this.$u.toast('学时不满足要求,请先完成学时');
				}else{
					let data ={ }
					 if (uni.getStorageSync("eduInfo").sentryPid == 3){
						data = {type:4}
					}
					request.getNewTestRoles({
						data,
						success:(res)=>{
							this.roleInfo = res
							if(this.roleInfo.paper_count == 0){
								this.$u.toast('考试次数已用完');
							}else{
								uni.navigateTo({
									url:"/pagesB/pages/newTestPeoplePaper/index"
								})
							}
						},
						fail:() => {
							uni.showToast({
								icon:"none",
								title:'获取数据失败'
							})
						}
					})
				}
			}
		}
	}
</script>

<style lang="less" scoped>
	.image-three-box{
		display: flex;
		flex-direction: column;
		align-items: center;
		margin-top: 58rpx;
		.image-three-box-item{
			display:flex;
			margin-top: 30rpx;
		}
		.image-three-box-item-detail{
			margin-left: 12rpx;
			font-size: 30rpx;
			font-family: PingFangSC, PingFangSC-Regular;
			font-weight: 400;
			text-align: center;
			color: #222222;
			line-height: 42rpx;
		}
	}
	.progress-introduce{
			font-size: 28rpx;
			font-family: PingFangSC, PingFangSC-Medium;
			font-weight: 500;
			text-align: center;
			color: #222222;
			line-height: 20rpx;
			margin-top: 44rpx;
	}
	.image-tow-line{
		width: 100%;
		border-top: 1rpx dashed rgba(74,135,253,0.29);
		margin: 46rpx 0;
	}
	.progress{
		margin-top: 100rpx;
		display:flex;
		justify-content: center;
		
		.u-progress-content{
			display:flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			.u-progress-dot{
				font-size: 40rpx;
				font-family: DINPro, DINPro-Medium;
				font-weight: 500;
				text-align: center;
				color: #222222;
				line-height:52rpx;
			}
			.u-progress-info{
				font-size: 22rpx;
				font-family: PingFangSC, PingFangSC-Regular;
				font-weight: 400;
				text-align: center;
				color: #737373;
				line-height: 30rpx;
			}
		}
	}
	.yuan-introduce{
		font-size: 26rpx;
		font-family: PingFangSC, PingFangSC-Regular;
		font-weight: 400;
		text-align: center;
		color: #737373;
		line-height: 36rpx;
	}
	.yuan-num{
		font-size: 40rpx;
		font-family: DINPro, DINPro-Medium;
		font-weight: 500;
		text-align: right;
		color: #222222;
		line-height:52rpx;
	}
	.yuan{
		width: 144rpx;
		height: 144rpx;
		border-radius: 50%;
		background-size: 100% 100%;
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
	}
	.yuan3{
		background-image: url('http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/43d216391454d1802acad8e8e5c387fc.png');
	}
	.yuan2{
		background-image: url('http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/0d7074a53eecb0f27e470e1660b81f57.png');
	}
	.yuan1{
		background-image: url('http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/f136949838afa53378d516d922f418a9.png');
	}
	.image-one-box{
		display: flex;
		justify-content: space-evenly;
		align-items:center;
		margin-top: 44rpx;
	}
	.box-introduce{
		height:36rpx;
		font-size: 25rpx;
		font-family: PingFangSC, PingFangSC-Regular;
		font-weight: 400;
		text-align: center;
		color: #222222;
		line-height: 36rpx;
		margin-top: 44rpx;
	}
	.box-top{
		padding-top: 16rpx;
		height: 46rpx;
		font-size:32rpx;
		font-family: PingFangSC, PingFangSC-Medium;
		font-weight: 500;
		text-align: center;
		color: #ffffff;
		line-height: 32rpx;
	}
	.box{
		background-color: #4077E3;
		box-sizing: border-box;
	}
	.box-mini-box{
		padding: 34rpx 20rpx 34rpx;
	}
	.image-one{
		height: 416rpx;
		background-image: url('http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/4fe15f4e97fff7cfef1ff069b4e97f27.png');
		background-size:100% 100% ;
	}
	.image-tow{
		display: flex;
		flex-direction: column;
		align-items: center;
		box-sizing: border-box;
		padding: 0 64rpx;
		height: 1116rpx;
		background-image: url('http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/e068e1570d3500801bd0f3a31a95beba.png');
		background-size:100% 100% ;
		margin-top: 20rpx;
	}
	.image-three{
		height: 356rpx;
		background-image: url('http://jjboss.oss-cn-hangzhou.aliyuncs.com/gztz_attachment/20220915/4175d391f3a333676fb852223ebfc9f3.png');
		background-size:100% 100% ;
		margin-top: 20rpx;
	}
	.buttom{
		height: 150rpx;
	}
	.fix-buttom{
		background-color: #fff;
		position: fixed;
		width: 100%;
		bottom:0;
		height: 150rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		.bg-box{
			display: flex;
			margin-right: 54rpx;
			height: 80rpx;
			align-items: center;
		}
		.times{
			height:80rpx;
			width: 450rpx;
			border-radius: 40rpx;
			line-height: 80rpx;
			text-align: center;
			background: #4a87fd;
			color: #fff;
			font-family: PingFangSC, PingFangSC-Medium;
			font-weight: 500;
		}
		.icon{
			background-image: url("https://jjboss.oss-cn-hangzhou.aliyuncs.com/mech/20220913/0c6efe86016684b3a318cdb646b5be37.png");
			background-size:100% 100%;
			width: 28rpx;
			height: 34rpx;
			margin-right:14rpx;
		}
	}

</style>
